package qing.controller.cms;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import qing.controller.CommonController;
import qing.entity.Supply;


@Controller
@RequestMapping("/cms/supply")
public class SupplyController  extends  CommonController<Supply,String> {

	

}
/*
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;

import qing.entity.Article;
import qing.entity.Person;
import qing.entity.Supply;
import qing.entity.Tpl;
import qing.service.SupplyService;

@Controller
@RequestMapping("/cms/supply")
public class SupplyController {

	@Autowired
	private SupplyService idao;
	
	@ResponseBody
	@RequestMapping("jsonlist")
	public List<Supply> showlists(Map<String, Object> map) {
		return idao.list();
		
	}
	

 //提交新增
	@ResponseBody
	@RequestMapping(value = "jsonadd", method = RequestMethod.POST)
	public String addpost(Supply model) {	
		if(model.getId()==null) {
		idao.save(model);
		}
		else {
			idao.update(model);
		}
		return "{\"status\":1,\"msg\":\"\"}";
	}
	
	//绑定会员模型
	@ModelAttribute
	public void getarticle(@RequestParam(value = "id", required = false) Integer id, Map<String, Object> map) {
		if (id != null) {			
			Supply supply= idao.get(id);
			map.put("supply",supply);
			System.out.println(supply);
		}
	}

	@RequestMapping(value = "jsonedit", method = RequestMethod.PUT,produces="application/json;charset=UTF-8")
	public  @ResponseBody Object editpost(Supply model) {			
			idao.update(model);		
			System.out.println("put:"+model);
		JSONObject js = new JSONObject();
        js.put("status", 1);
        return js;
	}
	
//删除
	@RequestMapping(value = "jsondel/{id}", method = RequestMethod.DELETE,produces="application/json;charset=UTF-8")
	public @ResponseBody Object deletesupply(@PathVariable("id") Integer id) {
		System.out.println("dele:" + id);
		idao.deleteById(id);
		JSONObject js = new JSONObject();
        js.put("status", 1);
        return js;
	}


}*/

